package com.ulife.order.api.response;

import com.ulife.common.gateway.utils.annotation.Description;

import java.io.Serializable;
import java.math.BigDecimal;
import java.text.DecimalFormat;

/**
 * Created by Ulife- on 2016/1/7.
 */
@Description("价格计算信息")
public class CalculationInfo implements Serializable {

    @Description("商品总金额")
    public double subAmount;
    @Description("商品优惠")
    public double promotionDiscount;
    @Description("优惠券商品优惠")
    public double productCouponDiscount;
    @Description("运费")
    public double shipFee;
    @Description("运费优惠")
    public double shipFeeDiscount;
    @Description("优惠券运费优惠")
    public double shipFeeCouponDiscount;
    @Description("总金额")

    public double totalAmount;

    public double getSubAmount() {
        return formatFloat(subAmount);
    }

    public void setSubAmount(double subAmount) {
        this.subAmount = subAmount;
    }

    public double getPromotionDiscount() {
        return formatFloat(promotionDiscount);
    }

    public void setPromotionDiscount(double promotionDiscount) {
        this.promotionDiscount = promotionDiscount;
    }

    public double getProductCouponDiscount() {
        return formatFloat(productCouponDiscount);
    }

    public void setProductCouponDiscount(double productCouponDiscount) {
        this.productCouponDiscount = productCouponDiscount;
    }

    public double getShipFee() {
        return formatFloat(shipFee);
    }

    public void setShipFee(double shipFee) {
        this.shipFee = shipFee;
    }

    public double getShipFeeDiscount() {
        return formatFloat(shipFeeDiscount);
    }

    public void setShipFeeDiscount(double shipFeeDiscount) {
        this.shipFeeDiscount = shipFeeDiscount;
    }

    public double getShipFeeCouponDiscount() {
        return formatFloat(shipFeeCouponDiscount);
    }

    public void setShipFeeCouponDiscount(double shipFeeCouponDiscount) {
        this.shipFeeCouponDiscount = shipFeeCouponDiscount;
    }

    public double getTotalAmount() {
        return formatFloat(totalAmount);
    }

    public void setTotalAmount(double totalAmount) {
        this.totalAmount = totalAmount;
    }

    private double formatFloat(double x){
        return   new Double(new DecimalFormat("###0.00").format(x));
    }
}
